package com.jiuyin.dianjing.view;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.fragment.app.DialogFragment;

import com.jiuyin.dianjing.R;

public class CustomDialogFragment extends DialogFragment {
    @Override
    public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        builder.setTitle(R.string.dialog_title_tips)
                .setMessage(R.string.dialog_content_cache_tips)
                .setPositiveButton(getString(R.string.dialog_confirm_tips),
                        (dialog, whichButton) -> getActivity().setResult(Activity.RESULT_OK)
                )
                .setNegativeButton(getString(R.string.dialog_cancel_tips),
                        (dialog, whichButton) -> getActivity().setResult(Activity.RESULT_CANCELED)
                )
                .setCancelable(false);
        return builder.create();
    }
}
